<% 
	var headContent = {
	include("/pages/template/head.html"){}
%>

<script type="text/javascript">
		
	var oper;
	jQuery(function($) {
		// 页面方法
		oper = {
			width : 400,
			height : 450,
			form : document.form1,
			list : function() {
				var url = 'admin/mission/list';
				this.form.action = url;
				this.form.submit();
			},
			view : function(id) {
				var url = 'admin/mission/view/'+id;
				var title = '查看系统设置的任务列表';
				Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
			},
			add : function() {
				var url = 'admin/mission/add';
				var title = '添加系统设置的任务列表';
				Iframe(url, this.width, this.height, title);
			},
			edit : function(id) {
				var url = 'admin/mission/edit/'+id;
				var title = '修改系统设置的任务列表';
				Iframe(url, this.width, this.height, title);
			},
			del : function(id) {
				var url = 'admin/mission/delete/'+id;
				var title = '确认要删除该系统设置的任务列表信息？';
				Confirm(title, function() {
					form1.action = url;
					form1.submit();
				});
			}
		};
		//显示Menu索引
		showMenu('page_mission');
	});
	
	//分页
	var paginator = function(page) {
		oper.list();
	};
</script>

<%
};

var bodyContent = {
%>
	<form name="form1" action="" method="post"  class="form-inline" role="form">
		<!-- 菜单 -->
		<% include("/pages/template/menu.html"){} %>
		
		<div class="tableSearch">
			<%  //查询列表 %>
			
			<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			 		<span class="glyphicon glyphicon-search"></span> 查 询
			</button>
			<button type="button" class="btn btn-default" onclick="resetForm();">
			 		<span class="glyphicon glyphicon-refresh"></span> 重 置
			</button>
			<button type="button" class="btn btn-default" onclick="oper.add();">
			 		<span class="glyphicon glyphicon-plus"></span> 新 增
			</button>
		</div>
		
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
					<th name="headcount" class="sorting">正在进行的人数</th> 
					<th name="hongmeng_coin" class="sorting">红檬健康币</th> 
					<th name="mission_name" class="sorting">任务名</th> 
					<th name="sys_plan_id" class="sorting">计划类型</th>
					<th name="mission_type_name" class="sorting">任务类型名字</th> 
					<th name="plan_stage" class="sorting">项目阶段</th>
 					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<% for(item in page.list){ %>
				<tr>
				<td>${itemLP.index }</td>
					<%  // 列表内容 %>
						<td>${item.headcount}</td> 
					<td>${item.hongmeng_coin}</td> 
					<td>${item.mission_name}</td> 
					<td>${item.sys_plan_id == 1?'减肥'} ${item.sys_plan_id == 2?'增重'} ${item.sys_plan_id == 3?'保持体重'}</td>
					<td>${item.mission_type_name}</td> 
					<td>${item.plan_stage ==1?'初级'} ${item.plan_stage ==2?'中级'} ${item.plan_stage ==3?'高级'}</td>
				<td>
				<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${item.mission_id});">查看</a> 
				<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${item.mission_id});">修改</a> 
				<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${item.mission_id});">删除</a>
				</td>
				</tr>
			<% } %>
			</tbody>
		</table>
		<%include("/static/component/include/paginator.html"){} %>
	</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>